<template>
<div>
  <el-dialog title="选择仓库" top="20vh" :visible.sync="dialogTableVisible">
    <el-table :data="WarehouseDetailsInfo">
      <el-table-column property="warName" label="仓库名"></el-table-column>
      <el-table-column property="warehouseDetailsInfoList[0].maxNum" label="最大值"></el-table-column>
      <el-table-column property="warehouseDetailsInfoList[0].amount" label="当前存储量"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            round
            type="primary"
            plain
            @click="putin(scope.row)"
          >放入该仓库</el-button>
        </template>
      </el-table-column>

    </el-table>
    <!-- 分页 -->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageno"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </el-dialog>
  <div>
    <component ref="Addwarehouse" is="Add_the_warehouse"></component>
  </div>
</div>
</template>

<script>
  import Add_the_warehouse from "./Add_the_warehouse";
    export default {
        name: "Dispatching_goods",
      data(){
          return{
            dialogTableVisible:false,
            pageno: 1,
            pagesize: 5,
            total: 1,
            WarehouseDetails:{},
            WarehouseDetailsInfo:[],
          }
      },
      methods:{
          getdataWarehouseDetails(){
           this.$axios.post("warehouseDetailsInfo/queryAllshopid.action", this.WarehouseDetails).then(res => {
              this.WarehouseDetailsInfo = res.data.records;
              this.total = res.data.total;
            }).catch(error => {
              this.$message.error(error)
            })
          },
        handleSizeChange(val) {
          //每页范围
          this.pagesize = val;
          this.getdataWarehouseDetails();
        },
        handleCurrentChange(val) {
          //当前页
          this.pageno = val;
          this.getdataWarehouseDetails();
        },
        putin(row){
          this.$refs.Addwarehouse.dialogTableVisible=true;
          this.$nextTick(item=>{
            this.$refs.Addwarehouse.bid=row.warehouseDetailsInfoList[0].id
            this.$refs.Addwarehouse.warehouse.amount =row.warehouseDetailsInfoList[0].amount
            this.$refs.Addwarehouse.warehouse.waname=row.warName
            this.$refs.Addwarehouse.warehouse.mNum=row.warehouseDetailsInfoList[0].maxNum
            this.$refs.Addwarehouse.getda()
          })
        }

      },
      components:{
        Add_the_warehouse
      }
    }
</script>

<style scoped>

</style>
